#pragma once

#include "../common.h"
#include "../vectormath.h"

namespace Tmpl {

#define MAX_RENDER_TEXTURES 16

class Map;
class ShaderProgram;
class MapRenderer
{
public:
	MapRenderer(Map* map, int renderSize);
	~MapRenderer();

	void Update(Vec3f playerPos, Vec3f facing);
	void Render(const Matrix4x4f& projection, const Matrix4x4f& modelView);

	int GetTriangleCount() const {return mRenderVertexCount-mRenderSize+1;}
	int GetTextureCount() const {return mRenderTextureCount;}
private:
	Map* mMap;
	int mRenderSize;
	ShaderProgram* mShader;
	GLuint mRenderVertexCount;
	GLuint mVboStrideSize;
	GLuint mVBO;
	GLuint mVBOIndices;
	GLuint mVAB;
	GLuint mTexId;
	GLfloat mRenderTextures[MAX_RENDER_TEXTURES];
	GLint mRenderTextureCount;
};

}; // namespace Tmpl